gdk: Get rid of gdk_draw_pixbuf() call
authorBenjamin Otte <otte@redhat.com>
Mon, 12 Jul 2010 11:27:41 +0000 (13:27 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 26 Jul 2010 14:42:49 +0000 (16:42 +0200)
Use Cairo code instead.

gdk/gdkpixbuf-render.c

index bd94aaf4d836014a92abdc2ec3e94bd7acb2c96e..fae5b12f2d839d23f5acff2bc66c776aa1e06855 100644 (file)
@@ -208,13 +208,11 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf   *pixbuf,
   
   if (pixmap_return)
     {
-      GdkGC *gc;
       *pixmap_return = gdk_pixmap_new (gdk_screen_get_root_window (screen),
                                       gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
                                       gdk_colormap_get_visual (colormap)->depth);
 
       gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap);
-      gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE);
 
       /* If the pixbuf has an alpha channel, using gdk_pixbuf_draw would give
        * random pixel values in the area that are within the mask, but semi-
@@ -222,17 +220,21 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf   *pixbuf,
        * see bug #487865.
        */
       if (gdk_pixbuf_get_has_alpha (pixbuf))
-        gdk_draw_rgb_32_image (*pixmap_return, gc,
-                               0, 0,
-                               gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
-                               GDK_RGB_DITHER_NORMAL,
-                               gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_rowstride (pixbuf));
+        {
+          GdkGC *gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE);
+          gdk_draw_rgb_32_image (*pixmap_return, gc,
+                                 0, 0,
+                                 gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
+                                 GDK_RGB_DITHER_NORMAL,
+                                 gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_rowstride (pixbuf));
+        }
       else
-        gdk_draw_pixbuf (*pixmap_return, gc, pixbuf, 
-                         0, 0, 0, 0,
-                         gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
-                         GDK_RGB_DITHER_NORMAL,
-                         0, 0);
+        {
+          cairo_t *cr = gdk_cairo_create (*pixmap_return);
+          gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+          cairo_paint (cr);
+          cairo_destroy (cr);
+        }
     }
   
   if (mask_return)